#ifndef _PROPERTYTYPES_H_BUOLA_WIDGETS_
#define _PROPERTYTYPES_H_BUOLA_WIDGETS_

#include <buola/gui/cpropertytype.h>
#include <buola/gui/cpropertyeditor.h>
#include <map>

namespace buola { namespace gui {

class CAnyPropertyType : public CPropertyType
{
public:
    CAnyPropertyType()
        :   CPropertyType(L"any") {}

    void InitValue(UAny&) {}
    void Draw(const UAny&,img::CGC*,const CRect_d&) {}
    CPropertyEditor *GetEditor()    {   return nullptr;    }

};

class CStringPropertyType : public CPropertyType
{
public:
    CStringPropertyType();

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    CPropertyEditor *GetEditor();

private:
    class Editor : public CPropertyEditor
    {
    public:
        Editor(CStringPropertyType *pType)
        {
            mType=pType;
            mEditBox=nullptr;
        }

        void Start(const UAny&,const PWindow &pWindow,const CRect_d&,const img::CColor &pColor);
        void Finish(UAny&);

        CStringPropertyType *mType;
        PEditBox mEditBox;
    };
};

class CIntPropertyType : public CPropertyType
{
public:
    CIntPropertyType();

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    CPropertyEditor *GetEditor();

private:
    class Editor : public CPropertyEditor
    {
    public:
        Editor(CIntPropertyType *pType)
        {
            mType=pType;
            mNumBox=nullptr;
        }

        void Start(const UAny&,const PWindow &pWindow,const CRect_d&,const img::CColor &pColor);
        void Finish(UAny&);

        CIntPropertyType *mType;
        PNumBox mNumBox;
    };
};

class CPointerPropertyType : public CPropertyType
{
public:
    CPointerPropertyType();

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    CPropertyEditor *GetEditor();

private:
    class Editor : public CPropertyEditor
    {
    public:
        Editor(CPointerPropertyType *pType)
        {
            mType=pType;
            mNumBox=nullptr;
        }

        void Start(const UAny&,const PWindow &pWindow,const CRect_d&,const img::CColor &pColor);
        void Finish(UAny&);

        CPointerPropertyType *mType;
        PNumBox mNumBox;
    };
};

class CDoublePropertyType : public CPropertyType
{
public:
    CDoublePropertyType();

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    CPropertyEditor *GetEditor();

private:
    class Editor : public CPropertyEditor
    {
    public:
        Editor(CDoublePropertyType *pType)
        {
            mType=pType;
            mNumBox=nullptr;
        }

        void Start(const UAny&,const PWindow &pWindow,const CRect_d&,const img::CColor &pColor);
        void Finish(UAny&);

        CDoublePropertyType *mType;
        PNumBox mNumBox;
    };
};

class CFileSizePropertyType : public CPropertyType
{
public:
    CFileSizePropertyType();

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    CPropertyEditor *GetEditor();
};

class CTransferSpeedPropertyType : public CPropertyType
{
public:
    CTransferSpeedPropertyType();

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    CPropertyEditor *GetEditor();
};

class CBoolPropertyType : public CPropertyType
{
public:
    CBoolPropertyType();

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    CPropertyEditor *GetEditor();

private:
    class Editor : public CPropertyEditor
    {
    public:
        Editor(CBoolPropertyType *pType)
        {
            mType=pType;
        }

        void Start(const UAny&,const PWindow &pWindow,const CRect_d&,const img::CColor &pColor);
        void Finish(UAny&);

        CBoolPropertyType *mType;
        PCheckBox mCheckBox;
    };
};

class CMultiPropertyType : public CPropertyType
{
public:
    CMultiPropertyType();

    void AddOption(int pInt,const std::wstring &pString);

    const std::wstring &GetOptionName(int pInt);

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    CPropertyEditor *GetEditor();

private:
    class Editor : public CPropertyEditor
    {
    public:
        Editor(CMultiPropertyType *pType)
        {
            mType=pType;
            mComboBox=nullptr;
        }

        void Start(const UAny&,const PWindow &pWindow,const CRect_d&,const img::CColor &pColor);
        void Finish(UAny&);

        CMultiPropertyType *mType;
        PComboBox mComboBox;
    };

private:
    std::map<int,std::wstring> mOptions;
};

class CURIPropertyType : public gui::CPropertyType
{
public:
    CURIPropertyType();

    void InitValue(UAny&);

    void Draw(const UAny&,img::CGC*,const CRect_d&);
    gui::CPropertyEditor *GetEditor();

private:
    class Editor : public gui::CPropertyEditor
    {
    public:
        Editor(CURIPropertyType *pType)
        {
            mType=pType;
//            mURIBox=nullptr;
        }

        void Start(const UAny&,const PWindow &pWindow,const CRect_d&,const img::CColor &pColor);
        void Finish(UAny&);

        CURIPropertyType *mType;
//        CURIBox *mURIBox;
    };
};

/*namespace gui*/ } /*namespace buola*/ }

#endif
